package com.csxy.dyq.util;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ConstantPropertiesUtil implements InitializingBean {

    @Value("${aliyun.oss.file.endpoint}")
    private String endpoint;

    @Value("${aliyun.oss.file.keyid}")
    private String keyid;

    @Value("${aliyun.oss.file.keysecret}")
    private String keysecret;

    @Value("${aliyun.oss.file.bucketname}")
    private String bucketname;

    public static String KEY_ID;     // 之前遗漏了 KEY_ID 的拼写一致性，也应一并修正
    public static String KEY_SECRET;
    public static String END_POINT;
    public static String BUCKET_NAME; // 修复：添加缺失的静态变量声明

    @Override
    public void afterPropertiesSet() throws Exception {
        KEY_ID = this.keyid;
        KEY_SECRET = this.keysecret;
        END_POINT = this.endpoint;
        BUCKET_NAME = this.bucketname; // 现在可以正确赋值
    }
}
